-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Profiler API to modify environment variables (#23383) #27157
Conversation
14a8863
to
9f7b81e
Compare
@k15tfu do you intend for this PR to serve as an API review? There is no implementation for the method here, so I am not sure what you intend. |
@davmason For the first time - yes. I wanted to be punctual and get the sign off first. After that I gonna update this PR and provide its implementation. |
9f7b81e
to
6724736
Compare
Anyway, I already have a draft for |
src/vm/proftoeeinterfaceimpl.cpp
Outdated
CONTRACTL | ||
{ | ||
// Yay! | ||
NOTHROW; | ||
|
||
// Yay! | ||
GC_NOTRIGGER; | ||
|
||
// Yay! | ||
MODE_ANY; | ||
|
||
// Yay! | ||
EE_THREAD_NOT_REQUIRED; | ||
|
||
// Yay! | ||
CANNOT_TAKE_LOCK; | ||
|
||
|
||
PRECONDITION(CheckPointer(szName, NULL_NOT_OK)); | ||
PRECONDITION(CheckPointer(szValue, NULL_OK)); | ||
} | ||
CONTRACTL_END; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I'm not sure if all of them are correct
6724736
to
0984ef0
Compare
0984ef0 - added interface for |
The signature for |
0984ef0
to
260734d
Compare
260734d - added impl for |
260734d
to
6d733da
Compare
6d733da - make them async |
6d733da
to
bbbd1c4
Compare
bbbd1c4 - add szName check in SetEnvironmentVariable |
bbbd1c4
to
298f430
Compare
298f430 - SetEnvironmentVariable returns GetLastError() in case of error |
298f430
to
53c9792
Compare
I think it looks good. What testing have you done? We should confirm that environment variables flow the way you expect, if you set one a child process inherits it, and you can pick it up from managed code, etc. CC @janvorli in case he has anything to add. |
1f73dd0
to
f712d07
Compare
f712d07 - fix log messages |
f712d07
to
0aa7e76
Compare
0aa7e76 - GetEnvironmentVariable returns S_OK (not ERROR_INSUFFICIENT_BUFFER) if buffer is nullptr. For example, |
0aa7e76
to
15ed902
Compare
15ed902 - code style fixes |
15ed902
to
c4c0ede
Compare
c4c0ede - rebase against ToT |
@davmason Yes, everything is fine now. I can get, set a new, override, or delete an environment variable as we expect. Also, after setting a new variable in |
@davmason I have also checked that it can be used asynchronously: I did a test, where C# in a loop updates env_var := env_var + 1 if env_var is even, and the profiler does the same thing but if env_var is odd. After 5 seconds they reached 120K. |
@davmason Nice. What should we do next to backport it to 3.1? Could you create a PR for that? |
@k15tfu I am starting the process of requesting the 3.1 port. I should know more early next week. One of the things I will be asked is what is the impact of not having this. If you could provide information about how this will impact your profiler that would help. |
@davmason Without this, we can lost all of our features related to child processes: 1) ability to profile child processes (for details see https://github.com/dotnet/coreclr/issues/23383#issuecomment-514587669), 2) ability to take snapshots automatically depending on child processes hierarchy, 3) unit-testing profiler support. Most likely, end user experience will be significantly worsened if our "tricks" stop working. |
No description provided.